# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor: Mark Wagie <mark dot wagie at tutanota dot com>
pkgname=cameractrls
pkgver=0.5.11
pkgrel=1
pkgdesc="Camera controls for Linux"
arch=('any')
url="https://github.com/soyersoyer/cameractrls"
license=('MIT')
depends=('gtk3' 'libjpeg-turbo' 'python' 'python-gobject' 'sdl2' 'systemd')
source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz")
sha256sums=('99dd28fff16a85fc7c071cbc1775ce77c802c5034e7f0019b7e8e4b2b2ab30eb')

package() {
  cd "$pkgname-$pkgver"
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  install -Dm755 cameractrls.py cameractrlsgtk.py cameraview.py cameractrlsgtk4.py -t \
    "${pkgdir}${site_packages}/CameraCtrls/"
  install -Dm644 "pkg/hu.irl.cameractrls.svg" -t "${pkgdir}${site_packages}/CameraCtrls/images/"
  install -Dm644 "pkg/hu.irl.cameractrls.metainfo.xml" -t "$pkgdir/usr/share/metainfo/"
  install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
  install -Dm644 pkg/hu.irl.cameractrls.desktop -t "$pkgdir/usr/share/applications/"

  install -d "$pkgdir"/usr/{bin,share/icons/hicolor/scalable/apps}
  ln -s "${site_packages}/CameraCtrls/cameractrls.py" "$pkgdir/usr/bin/$pkgname"
  ln -s "${site_packages}/CameraCtrls/cameractrlsgtk.py" "$pkgdir/usr/bin/${pkgname}gtk.py"
  ln -s "${site_packages}/CameraCtrls/cameractrlsgtk4.py" "$pkgdir/usr/bin/${pkgname}gtk4.py"
  ln -s "${site_packages}/CameraCtrls/images/hu.irl.cameractrls.svg" "$pkgdir/usr/share/icons/hicolor/scalable/apps/hu.irl.cameractrls.svg"
}
